package com.xpec.c4.db.model.log;

/**
 * 分析遊戲用的記錄節點
 * @author Miriam_Chen
 *
 */
public enum Action {
	/**
	 * ******************注意************************
	 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	 * 此Enum的內容意義與actionId的對應不可更改.否則已存的log資訊以actionId記錄到log db,其actionId代表的意義將會錯亂
	 * progressInCategory意思是該節點在action category中的第X步,其值不使用1,2,3..的緊鄰號碼,而是用10,20,30...這是為了預留空間,萬一以後有中間插入的流程,才有空間加progress
	 */
	REGISTER_GAME(10001, "激活:第一次從Tencent點擊開始遊戲", true, ActionCategory.PLAYER_JOIN_GAME_PROGRESS, 10)
	,BEGIN_CREATE_CHARACTER(10002, "進入到創角介面:與Server建立連線成功", true, ActionCategory.PLAYER_JOIN_GAME_PROGRESS, 20)
	,CONNECT_SVR_FAILED(10003, "與Server建立連線失敗", false, ActionCategory.NO_CATEGORY, 0)
	,CREATE_CHARACTER_SUCCESS(10004, "創角成功", true, ActionCategory.PLAYER_JOIN_GAME_PROGRESS, 30)
	,CREATE_CHARACTER_FAILED(10005, "創角失敗", false, ActionCategory.NO_CATEGORY, 0)
	,END_CREATE_CHARACTER(10006, "結束創角", false, ActionCategory.NO_CATEGORY, 0)
	,GAME_LOAD_COMPLETE(10007, "主程式加載成功並已初始化成功", false, ActionCategory.NO_CATEGORY, 0)
	,START_GAME(10008, "進入場景:player創角完緊接著到達新手引導畫面", true, ActionCategory.PLAYER_JOIN_GAME_PROGRESS, 40);
	
	private int actionId;
	private ActionCategory actionCategory;
	private int progressInCategory;
	private String description;
	private boolean active;
	private Action(int actId, String desc, boolean active, ActionCategory category, int progressInCategory) {
		this.actionId = actId;
		this.description = desc;
		this.active = active;
		this.actionCategory = category;
		this.progressInCategory = progressInCategory;
	}
	public int getActionId() {
		return actionId;
	}
	public String getDescription() {
		return description;
	}
	public boolean isActive() {
		return active;
	}
	public ActionCategory getActionCategory() {
		return actionCategory;
	}
	public int getProgressInCategory() {
		return progressInCategory;
	}
	public static Action getByActionId(int actionId) {
		for(Action p : Action.values()) {
			if(p.getActionId() == actionId) {
				return p;
			}
		}
		return null;
	}
}
